from django.db import models

# Create your models here.


class UserModel(models.Model):
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=150)
    level = models.CharField(max_length=5, choices=((0, '超级管理员'), (1, '高级会员'), (2, '普通会员')))
    money = models.FloatField(null=True, default=0)


class GoodsModel(models.Model):
    title = models.CharField(max_length=20)
    price = models.FloatField()
    level = models.CharField(max_length=5, choices=((1, '富帅套餐'), (2, '屌丝套餐')))
    num = models.IntegerField(null=True, default=0)


class RecordModel(models.Model):
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE)
    goods = models.ForeignKey(GoodsModel, on_delete=models.CASCADE)
    start = models.DateTimeField(auto_now_add=True)
    end = models.DateTimeField(auto_now=True)
    time = models.FloatField(null=True)
    money = models.FloatField(null=True)